Date & Time (datetime)

DateTime (datetime)

 

 

{ }

Example Response

{}

new

year, month and day arguments are required. Arguments are integers (or string representations of integers), in the following ranges:

  • 1 <= year <= 9999
  • 1 <= month <= 12
  • 1 <= day <= number of days in the given month and year
If an argument outside those ranges is given, an error is raised.

Time arguments are optional. Arguments are integers (or string representations of integers), in the following ranges:
  • 0 <= hour <= 23
  • 0 <= minute <= 59
  • 0 <= second <= 59
  • 0 <= microsecond <= 999999
If an argument outside those ranges is given, an error is raised.

 

{ }
[{"paths":[],"data":{"datetime":"datetime","call":"datetime.date.new","datetime.date.new":"new","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"year":2015,"month":1,"day":15,"hour":12,"minute":34,"second":56,"microsecond":123456},"height":32,"width":120,"step":"set new_date","data_to_var":"new_date","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"new_date":1421325296123456}

today

Return the current date. All dates are GMT+0. For this example we're using the date 01/15/2015 00:00:00.000000.

 

{ }
[{"paths":[],"data":{"datetime":"datetime","call":"datetime.date.today","datetime.date.today":"today","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{},"height":32,"width":120,"step":"set today_date","data_to_var":"today_date","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"today_date":1421280000000000}

now

Return the current local date and time. All dates are GMT+0. For this example we're using the date 01/15/2015 12:34:56.123456

 

{ }
[{"paths":[],"data":{"datetime":"datetime","call":"datetime.date.now","datetime.date.now":"now","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{},"height":32,"width":120,"step":"set now_datetime","data_to_var":"now_datetime","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"now_datetime":1421325296123456}

fromordinal

Return the date corresponding to the proleptic Gregorian ordinal, where January 1 of year 1 has ordinal 1. For this example we're using the ordinal corresponding to the datetime 01/15/2015 00:00:00.000000.

 

{ }
[{"paths":[],"data":{"datetime":"datetime","call":"datetime.datetime.fromordinal","datetime.datetime.fromordinal":"fromordinal","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"ordinal":735613},"height":32,"width":120,"step":"set ord_datetime","data_to_var":"ord_datetime","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"ord_datetime":1421280000000000}

year

Return the year for the date provided. Between min_year and max_year inclusive. For this example we're using the datetime 01/15/2015 12:34:56.123456.

 

{ }
[{"paths":[],"data":{"datetime":"datetime","call":"datetime.date.year","datetime.date.year":"year","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"date":1421325296123456},"height":32,"width":120,"step":"set datetime_year","data_to_var":"datetime_year","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"datetime_year":2015}

month

Return the month for the date provided. Between 1 and 12 inclusive. For this example we're using the datetime 01/15/2015 12:34:56.123456.

 

{ }
[{"paths":[],"data":{"datetime":"datetime","call":"datetime.date.month","datetime.date.month":"month","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"date":1421325296123456},"height":32,"width":120,"step":"set datetime_month","data_to_var":"datetime_month","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"datetime_month":1}

day

Return the day for the date provided. Between 1 and the number of days in the given month of the given year. For this example we're using the datetime 01/15/2015 12:34:56.123456.

 

{ }
[{"paths":[],"data":{"datetime":"datetime","call":"datetime.date.day","datetime.date.day":"day","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"date":1421325296123456},"height":32,"width":120,"step":"set datetime_day","data_to_var":"datetime_day","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"datetime_day":15}

hour

Return the hour for the datetime provided. Between min_hour and max_hour inclusive. For this example we're using the datetime 01/15/2015 12:34:56.123456.

 

{ }
[{"paths":[],"data":{"datetime":"datetime","call":"datetime.date.hour","datetime.date.hour":"hour","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"date":1421325296123456},"height":32,"width":120,"step":"set datetime_hour","data_to_var":"datetime_hour","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"datetime_hour":12}

minute

Return the minute for the datetime provided. Between min_minute and max_minute inclusive. For this example we're using the datetime 01/15/2015 12:34:56.123456.

 

{ }
[{"paths":[],"data":{"datetime":"datetime","call":"datetime.date.minute","datetime.date.minute":"minute","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"date":1421325296123456},"height":32,"width":120,"step":"set datetime_minute","data_to_var":"datetime_minute","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"datetime_minute":34}

second

Return the second for the datetime provided. Between min_second and max_second inclusive. For this example we're using the datetime 01/15/2015 12:34:56.123456.

 

{ }
[{"paths":[],"data":{"datetime":"datetime","call":"datetime.date.second","datetime.date.second":"second","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"date":1421325296123456},"height":32,"width":120,"step":"set datetime_second","data_to_var":"datetime_second","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"datetime_second":56}

microsecond

Return the microsecond for the datetime provided. Between min_microsecond and max_microsecond inclusive. For this example we're using the datetime 01/15/2015 12:34:56.123456.

 

{ }
[{"paths":[],"data":{"datetime":"datetime","call":"datetime.date.microsecond","datetime.date.microsecond":"microsecond","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"date":1421325296123456},"height":32,"width":120,"step":"set datetime_microsecond","data_to_var":"datetime_microsecond","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"datetime_microsecond":123456}

date

Return the datetime beginning the day for the date provided . All dates are GMT+0. For this example we're using the date 01/15/2015 12:34:56.123456. This will return 01/15/2015 00:00:00.000000

 

{ }
[{"paths":[],"data":{"datetime":"datetime","call":"datetime.date.date","datetime.date.date":"date","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"date":1421325296123456},"height":32,"width":120,"step":"get the_date","data_to_var":"the_date","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"the_date":1421280000000000}

time

Return the time with the date data omitted. For this example we're using the date 01/15/2015 12:34:56.123456. This will return the time value for 12:34:56.123456 in microseconds (45296123456).

 

{ }
[{"paths":[],"data":{"datetime":"datetime","call":"datetime.date.time","datetime.date.time":"time","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"date":1421325296123456},"height":32,"width":120,"step":"get time","data_to_var":"the_time","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"the_time":45296123456}

replace

Return a date with the same value, except for those parameters given new values by whichever keyword arguments are specified. For this example we're using the date 01/01/1970 00:00:00.000000 and replacing it with 01/15/2015 12:34:56.123456.

 

{ }
[{"paths":[],"data":{"datetime":"datetime","call":"datetime.date.replace","datetime.date.replace":"replace","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"date":0,"year":2015,"month":1,"day":15,"hour":12,"minute":34,"second":56,"microsecond":123456},"height":32,"width":120,"step":"replace datetime","data_to_var":"replaced_datetime","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"replaced_datetime":1421325296123456}

toordinal

Return the proleptic Gregorian ordinal of the date, where January 1 of year 1 has ordinal 1. For this example we're using the ordinal corresponding to the datetime 01/15/2015 00:00:00.000000.

 

{ }
[{"paths":[],"data":{"datetime":"datetime","call":"datetime.datetime.toordinal","datetime.datetime.toordinal":"toordinal","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"date":1421280000000000},"height":32,"width":120,"step":"set the_ordinal","data_to_var":"the_ordinal","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"the_ordinal":735613}

weekday

Return the day of the week as an integer, where Monday is 0 and Sunday is 6. For this example we're using the ordinal corresponding to the datetime 01/15/2015 00:00:00.000000, which is a Thursday (3).

 

{ }
[{"paths":[],"data":{"datetime":"datetime","call":"datetime.datetime.weekday","datetime.datetime.weekday":"weekday","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"date":1421280000000000},"height":32,"width":120,"step":"set the_weekday","data_to_var":"the_weekday","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"the_weekday":3}

isoweekday

Return the day of the week as an integer, where Monday is 1 and Sunday is 7. For this example we're using the ordinal corresponding to the datetime 01/15/2015 00:00:00.000000, which is a Thursday (4).

 

{ }
[{"paths":[],"data":{"datetime":"datetime","call":"datetime.datetime.isoweekday","datetime.datetime.isoweekday":"isoweekday","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"date":1421280000000000},"height":32,"width":120,"step":"set the_isoweekday","data_to_var":"the_isoweekday","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"the_isoweekday":4}

isocalendar

Return a dict/object with the ISO year, ISO week number, and ISO weekday values.

The ISO calendar is a widely used variant of the Gregorian calendar. See http://www.staff.science.uu.nl/~gent0113/calendar/isocalendar.htm for a good explanation.

The ISO year consists of 52 or 53 full weeks, and where a week starts on a Monday and ends on a Sunday. The first week of an ISO year is the first (Gregorian) calendar week of a year containing a Thursday. This is called week number 1, and the ISO year of that Thursday is the same as its Gregorian year.

For this example we're using the ordinal corresponding to the datetime 01/15/2015 00:00:00.000000.

 

{ }
[{"paths":[],"data":{"datetime":"datetime","call":"datetime.datetime.isocalendar","datetime.datetime.isocalendar":"isocalendar","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"date":1421280000000000},"height":32,"width":120,"step":"set the_isocalendar","data_to_var":"the_isocalendar","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"the_isocalendar":{"week":3,"weekday":4,"year":2015}}

readable

Readable is an alias for datetime.datetime.isoformat. Return a string representing the date and time in ISO 8601 format, YYYY-MM-DDTHH:MM:SS.mmmmmm+HH:MM or, if microsecond is 0, YYYY-MM-DDTHH:MM:SS+HH:MM. For this example we're using the ordinal corresponding to the datetime 01/15/2015 00:00:00.000000.

 

{ }
[{"paths":[],"data":{"datetime":"datetime","call":"datetime.datetime.isoformat","datetime.datetime.isoformat":"isoformat","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"date":1421280000000000},"height":32,"width":120,"step":"set iso_datetime","data_to_var":"iso_datetime","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"iso_datetime":"2015-01-15T00:00:00+00:00"}

isoformat

Return a string representing the date and time in ISO 8601 format, YYYY-MM-DDTHH:MM:SS.mmmmmm+HH:MM or, if microsecond is 0, YYYY-MM-DDTHH:MM:SS+HH:MM. For this example we're using the ordinal corresponding to the datetime 01/15/2015 00:00:00.000000.

 

{ }
[{"paths":[],"data":{"datetime":"datetime","call":"datetime.datetime.isoformat","datetime.datetime.isoformat":"isoformat","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"date":1421280000000000},"height":32,"width":120,"step":"set iso_datetime","data_to_var":"iso_datetime","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"iso_datetime":"2015-01-15T00:00:00+00:00"}

strptime

Return a datetime corresponding to string, parsed according to format. An error is raised if the string and format can't be parsed or if it returns a value which isn't a valid datetime

 

{ }
[{"paths":[],"data":{"datetime":"datetime","call":"datetime.datetime.strptime","datetime.datetime.strptime":"strptime","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"string":"21\/11\/06 16:30","format":"%d\/%m\/%y %H:%M"},"height":32,"width":120,"step":"set parsed_datetime","data_to_var":"parsed_datetime","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"parsed_datetime":1164126600000000}

strftime

Return a string representing the date and time, controlled by an explicit format string

 

{ }
[{"paths":[],"data":{"datetime":"datetime","call":"datetime.datetime.strftime","datetime.datetime.strftime":"strftime","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"date":1164126600000000,"format":"%d\/%m\/%y %H:%M"},"height":32,"width":120,"step":"format datetime","data_to_var":"formatted_datetime","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"formatted_datetime":"21\/11\/06 16:30"}